Redis output to store last values #35
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/
This PR augments the original
logstash-redis-output
plugin to store the last value(s) of each key in the event object.The original redis output stores every event in a LIST, which just grows undefinitely unless trimmed by some other consumer.
This PR adds 2 modes:
last_n_values
will store the last n values of each key in the event object into a LIST (LPUSH and TRIM) with an EXPIRE value if defined.stack_size
defines how many values are kept.last_value
will store the last value of each key in the event object with SET with an EXPIRE value if defined.In both cases the keys are stores under the top level key defined by
key
, into a tree structure matching the object.Each write is done in a MULTI transaction so as to be sure to store all key/values at once.
Note: Since 5.alpha is alpha and not quite out yet, the PR is for Logstash 2.3.x, so the version number and dependencies are matching this version.
Let me know if this needs more attention.